package com.example.timeline.checktype;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.timeline.R;
import com.example.timeline.recycleAdapter.CommonAdapter;

import org.w3c.dom.Text;

/**
 * Created by Administrator on 2017/8/7 0007.
 */

public class TypeOneHanlder implements CommonAdapter.DataHandler<CheckDataItem> {
    private final int viewType = 100;
    @Override
    public View getView(Context context, int viewType) {
        if(this.viewType != viewType){
            return null;
        }
        return View.inflate(context, R.layout.view_one,null);
    }

    @Override
    public int getItemViewType(CheckDataItem item) {
        if(item.type.equals("one")){
            return viewType;
        }
        return CommonAdapter.NOT_MATCH_TYPE;
    }

    @Override
    public boolean onBindViewHolder(int viewType,CommonAdapter.MyViewHolder holder, CheckDataItem item) {
        if(this.viewType != viewType){
            return false;
        }
        TextView text  = (TextView) holder.view.findViewById(R.id.textView);
        text.setText("type:"+item.type+"  content:"+item.content+" #view:"+holder.view);
        return true;
    }
}
